#!/usr/bin/env ./jshost

//sleep(3000);

alert("zhop1");

var doit=function(fd){
//	write(fd,"Your fd="+fd+"\r\n");

	var headers=read(fd).split(/\r\n/);
	
//	alert("HEADERS:\n==="+headers.join("\n==="));

	write(fd,[
		"HTTP/1.1 200 OK",
		"Content-Type: text/html; charset=UTF-8",
		"",
		"<h1>huy</h1>",
		""
	].join("\n"));
	var i=10;
	for(;i>=0;--i){
		write(fd,"<div>i="+i+"</div>\r\n");
		sleep(300);
	}
};



onrequest=function(x){
	doit(x);
};

start_httpserver(false);

//sleep(3600*1000);


